package ModelLayer;


/**
 * Write a description of class Machine here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Machine
{
    private String id;
    private String name;
    private double price_per_day;
    private boolean is_leased;
    /**
     * Constructor for objects of class Machine
     */
    public Machine(String i_id, String i_name, double i_price_per_day, boolean i_is_leased)
    {
        id = i_id;
        name = i_name;
        price_per_day = i_price_per_day;
        is_leased = i_is_leased;
    }

    
    /*************************************************GETTERS****************************************************/
    
    public String get_id()
    {
        return id;
    }
    
    public String get_name()
    {
        return name;
    }
    
    public double get_price_per_day()
    {
        return price_per_day;
    }
    
    public boolean get_is_leased()
    {
        return is_leased;
    }
    
    /*************************************************SETTERS****************************************************/

    public void set_id(String input)
    {
        id = input;
    }
    
    public void set_name(String input)
    {
        name = input;
    }
    
    public void set_price_per_day(double input)
    {
        price_per_day = input;
    }
    
    public void set_is_leased(boolean input)
    {
        is_leased = input;
    }
    
    /***************************************************************OTHER METHODS*****************************************************************/
    
    public String give_string_data()
    {        
        return String.format("%s\t%s\t%s\t%s", id, name, price_per_day, is_leased);        
    }
    
    public String printable()
    {
        return String.format("ID:\t\t\t\t%s \nName of the machine:\t\t%s \nPrice per day of lease:\t\t%s \nAvability:\t\t\t%s \n", id, name, price_per_day, convert_is_leased());
    }
    
    private String convert_is_leased()
    {
        if(is_leased)
        {
            return "Unavailable";
        }
        return "Available";
    }
    
    public boolean is_unfinished()
    {
        return price_per_day == 0;
    }

}
